package edu.hnnu.sport_event.service;

import edu.hnnu.sport_event.entity.SignUp;
import edu.hnnu.sport_event.entity.Student;
import edu.hnnu.sport_event.mapper.SignUpMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class SignUpService implements BasicService<SignUp>{

    @Resource
    SignUpMapper signUpMapper;

    @Override
    public int insert(SignUp signUp) {
        return 0;
    }

    @Override
    public int delete(int id) {
        return signUpMapper.delete(id);
    }

    @Override
    public int modify(SignUp signUp) {
        return 0;
    }

    @Override
    public SignUp select(int id) {
        return null;
    }

    public SignUp selectByEventId(int eventId) {
        return signUpMapper.selectByEventId(eventId);
    }

    // 插入报名表
    public int add(int studentId, int eventId) {
        return signUpMapper.add(studentId, eventId);
    }

    // 删除报名表
    public int del(int studentId, int eventId) {
        return signUpMapper.deleteScoreInfo(studentId, eventId);
    }

    public Student ScoringInfo(int id) {
        return signUpMapper.selectInfo(id);
    }

    public int update(int id, int franction) {
        return signUpMapper.update(id, franction);
    }

}
